home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 965 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Alignment restrictions...
  5. Date: Wed, 10 Jan 96 14:55:37 GMT
  6. Organization: none
  7. Message-ID: <821285737snz@genesis.demon.co.uk>
  8. References: <DKxHxG.EK1@ridgecrest.ca.us> <821232137snz@genesis.demon.co.uk> <DKyBK5.5r6@ridgecrest.ca.us>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <DKyBK5.5r6@ridgecrest.ca.us>
  15.            mcclung@owens.ridgecrest.ca.us "Scott McClung" writes:
  16.  
  17. >In article <821232137snz@genesis.demon.co.uk>,
  18. >Lawrence Kirby  <fred@genesis.demon.co.uk> wrote:
  19. >
  20. >> What are the byte order conventions in the 'image file'? What you
  21. >> have here assumes big endian while the code at the top just assumes
  22. >> the byte order is the same as the target variable. In the latter
  23. >> case this problem is easily solved by:
  24. >>
  25. >>    memcpy(&value, ptr, sizeof value);
  26. >
  27. >Big endian.  The files are RLA images, animation frames, generated
  28. >by Composer from WaveFront.  The program converts RLA to YUV.
  29.  
  30. In that case your shift/or version is more portable since it doesn't depend
  31. on the byte order of the system.
  32.  
  33. >
  34. >> I suspect that the tailored inline code that a good compiler can
  35. >> generate for memcpy, especially with a fixed, small size would be
  36. >> difficult to beat.
  37. >
  38. >I guess I'll check the assembly output of the compiler to make sure
  39. >that it's really putting the memcpy() calls inline.
  40.  
  41. gcc will certainly inline standard library functions such as memcpy, so
  42. long as you have suitable optimisation options selected.
  43.  
  44. -- 
  45. -----------------------------------------
  46. Lawrence Kirby | fred@genesis.demon.co.uk
  47. Wilts, England | 70734.126@compuserve.com
  48. -----------------------------------------
  49.